package com.xzw.test.springcloud;

import com.xzw.test.springcloud.filter.AccessFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
// debug 模式访问直接抛异常 https://blog.csdn.net/Ryan_black/article/details/105239129
// 网关访问 http://localhost:8003/cloud-feign/feign/payment/get/1?accessToken=123
//http://localhost:8003/cloud-payment-service/payment/get/1?accessToken=123

/**
 * zuul 集成了Hystrix(断路器/熔断器)和ribbon(负载均衡)
 */
@EnableEurekaClient
@EnableZuulProxy
@SpringBootApplication
@RibbonClient(value = "cloud-payment-service")//提供者
public class ZuulApp
{
    public static void main( String[] args )
    {
        SpringApplication.run(ZuulApp.class, args);
    }

    @Bean
    public AccessFilter accessFilter() {
        return new AccessFilter();
    }
}
